package ar.edu.unq.leezsi.html;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import ar.edu.unq.leezsi.core.Context;

public class ComponentConfigurator {

	private final Context context;

	public ComponentConfigurator(Context context) {
		this.context = context;
	}

	public ComponentConfigurator configure(Component<?> component) {
		component.setContext(this.context);
		return this;
	}

	public void render(Page<?> page, HttpServletResponse res)
			throws IOException {
		page.renderOn(res);
		res.flushBuffer();
	}
}
